package com.zff.rental.controller.apartment;


import com.zff.rental.AppConstant;
import com.zff.rental.common.Result;
import com.zff.rental.service.apartment.RoomServer;
import com.zff.rental.vo.apartment.room.RoomGroupByFloor;
import com.zff.rental.vo.apartment.room.RoomGroupByFloorParams;
import com.zff.rental.vo.apartment.room.TouristsViewRoomDetails;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 房间
 *
 * @author HCY
 */
@RestController
@RequestMapping(AppConstant.RM_ROOM)
public class RoomController {
    @Resource
    private RoomServer roomServer;

    /**
     * 公寓所有房间
     */
    @PostMapping("/allGroupByFloor")
    public Result<List<RoomGroupByFloor>> allGroupByFloor(@RequestBody RoomGroupByFloorParams params) {
        List<RoomGroupByFloor> result = roomServer.allGroupByFloor(params);
        return Result.success(result);
    }

    /**
     * 游客查看房间详情
     */
    @GetMapping("/touristsViewRoomDetails")
    public Result<TouristsViewRoomDetails> details(@RequestParam("id") Long id) {
        TouristsViewRoomDetails result = roomServer.touristsViewRoomDetails(id);
        return Result.success(result);
    }
}